package com.hejjon.timer.test;

import java.util.Timer;
import java.util.TimerTask;

/**
 * Created by caoshi at 20:40 2021-08-14
 */
public class TimerTest2 {


    public static void test2() {

        Timer timer = new Timer();
        timer.scheduleAtFixedRate(new TimerTask() {
            @Override
            public void run() {
                System.out.println("AtFixedRate1");
            }
        }, TimerTest1.getDelayTime(1), 1000);

        timer.scheduleAtFixedRate(new TimerTask() {
            @Override
            public void run() {
                System.out.println("AtFixedRate2");
            }
        }, 2000, 1000);

    }


}
